home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.ItemEvent;
- import java.awt.event.ItemListener;
- import java.io.Serializable;
- import javax.swing.event.ChangeEvent;
- import javax.swing.event.ChangeListener;
- import javax.swing.event.EventListenerList;
-
- public class DefaultButtonModel implements ButtonModel, Serializable {
- protected int stateMask = 0;
- protected String actionCommand = null;
- protected ButtonGroup group = null;
- protected int mnemonic = 0;
- protected transient ChangeEvent changeEvent = null;
- protected EventListenerList listenerList = new EventListenerList();
- public static final int ARMED = 1;
- public static final int SELECTED = 2;
- public static final int PRESSED = 4;
- public static final int ENABLED = 8;
- public static final int ROLLOVER = 16;
- // $FF: synthetic field
- static Class class$javax$swing$event$ChangeListener;
- // $FF: synthetic field
- static Class class$java$awt$event$ActionListener;
- // $FF: synthetic field
- static Class class$java$awt$event$ItemListener;
-
- public DefaultButtonModel() {
- this.stateMask = 0;
- this.setEnabled(true);
- }
-
- public void addActionListener(ActionListener var1) {
- this.listenerList.add(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- public void addChangeListener(ChangeListener var1) {
- this.listenerList.add(class$javax$swing$event$ChangeListener != null ? class$javax$swing$event$ChangeListener : (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")), var1);
- }
-
- public void addItemListener(ItemListener var1) {
- this.listenerList.add(class$java$awt$event$ItemListener != null ? class$java$awt$event$ItemListener : (class$java$awt$event$ItemListener = class$("java.awt.event.ItemListener")), var1);
- }
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
-
- protected void fireActionPerformed(ActionEvent var1) {
- Object[] var2 = this.listenerList.getListenerList();
-
- for(int var3 = var2.length - 2; var3 >= 0; var3 -= 2) {
- if (var2[var3] == (class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")))) {
- ((ActionListener)var2[var3 + 1]).actionPerformed(var1);
- }
- }
-
- }
-
- protected void fireItemStateChanged(ItemEvent var1) {
- Object[] var2 = this.listenerList.getListenerList();
-
- for(int var3 = var2.length - 2; var3 >= 0; var3 -= 2) {
- if (var2[var3] == (class$java$awt$event$ItemListener != null ? class$java$awt$event$ItemListener : (class$java$awt$event$ItemListener = class$("java.awt.event.ItemListener")))) {
- ((ItemListener)var2[var3 + 1]).itemStateChanged(var1);
- }
- }
-
- }
-
- protected void fireStateChanged() {
- Object[] var1 = this.listenerList.getListenerList();
-
- for(int var2 = var1.length - 2; var2 >= 0; var2 -= 2) {
- if (var1[var2] == (class$javax$swing$event$ChangeListener != null ? class$javax$swing$event$ChangeListener : (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")))) {
- if (this.changeEvent == null) {
- this.changeEvent = new ChangeEvent(this);
- }
-
- ((ChangeListener)var1[var2 + 1]).stateChanged(this.changeEvent);
- }
- }
-
- }
-
- public String getActionCommand() {
- return this.actionCommand;
- }
-
- public int getMnemonic() {
- return this.mnemonic;
- }
-
- public Object[] getSelectedObjects() {
- return null;
- }
-
- public boolean isArmed() {
- return (this.stateMask & 1) != 0;
- }
-
- public boolean isEnabled() {
- return (this.stateMask & 8) != 0;
- }
-
- public boolean isPressed() {
- return (this.stateMask & 4) != 0;
- }
-
- public boolean isRollover() {
- return (this.stateMask & 16) != 0;
- }
-
- public boolean isSelected() {
- return (this.stateMask & 2) != 0;
- }
-
- public void removeActionListener(ActionListener var1) {
- this.listenerList.remove(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- public void removeChangeListener(ChangeListener var1) {
- this.listenerList.remove(class$javax$swing$event$ChangeListener != null ? class$javax$swing$event$ChangeListener : (class$javax$swing$event$ChangeListener = class$("javax.swing.event.ChangeListener")), var1);
- }
-
- public void removeItemListener(ItemListener var1) {
- this.listenerList.remove(class$java$awt$event$ItemListener != null ? class$java$awt$event$ItemListener : (class$java$awt$event$ItemListener = class$("java.awt.event.ItemListener")), var1);
- }
-
- public void setActionCommand(String var1) {
- this.actionCommand = var1;
- }
-
- public void setArmed(boolean var1) {
- if (this.isArmed() != var1 && this.isEnabled()) {
- if (var1) {
- this.stateMask |= 1;
- } else {
- this.stateMask &= -2;
- }
-
- this.fireStateChanged();
- }
- }
-
- public void setEnabled(boolean var1) {
- if (this.isEnabled() != var1) {
- if (var1) {
- this.stateMask |= 8;
- } else {
- this.stateMask &= -9;
- }
-
- this.fireStateChanged();
- }
- }
-
- public void setGroup(ButtonGroup var1) {
- this.group = var1;
- }
-
- public void setMnemonic(int var1) {
- this.mnemonic = var1;
- this.fireStateChanged();
- }
-
- public void setPressed(boolean var1) {
- if (this.isPressed() != var1 && this.isEnabled()) {
- if (var1) {
- this.stateMask |= 4;
- } else {
- this.stateMask &= -5;
- }
-
- if (!this.isPressed() && this.isArmed()) {
- this.fireActionPerformed(new ActionEvent(this, 1001, this.getActionCommand()));
- }
-
- this.fireStateChanged();
- }
- }
-
- public void setRollover(boolean var1) {
- if (this.isRollover() != var1 && this.isEnabled()) {
- if (var1) {
- this.stateMask |= 16;
- } else {
- this.stateMask &= -17;
- }
-
- this.fireStateChanged();
- }
- }
-
- public void setSelected(boolean var1) {
- if (this.isSelected() != var1) {
- if (var1) {
- this.stateMask |= 2;
- } else {
- this.stateMask &= -3;
- }
-
- this.fireItemStateChanged(new ItemEvent(this, 701, this, var1 ? 1 : 2));
- this.fireStateChanged();
- }
- }
- }
-